package finalproject.model.items;

import finalproject.model.player.Player;
import finalproject.model.studies.Lecture;
import finalproject.view.StringManager;
 
/**
 * An item used to certify a player as attended the corresponding lecture
 * @author user
 *
 */
public class LectureItem extends Item{

	/**
	 * The associated lecture
	 */
	private Lecture lecture;
	
	/**
	 * The constructor of lectureitem
	 * @param lecture The lecture the item is representing
	 */
	public LectureItem(Lecture lecture)
	{
		super(lecture.getTitle(), StringManager.getString("lectureitemdescription"), 1, true, true, false);
		
		this.lecture = lecture;
	}
	
	@Override
	public void use(Player p) 
	{  if(p.getEnergy().getEnergy() != 0)
	{
	    p.getEnergy().setEnergy(p.getEnergy().getEnergy()-1);
		StringManager.outPut("uselectureitem");
	}
		else
		{
		    StringManager.outPutText(StringManager.getString("exhausted")); 
		}
	}

	/**
	 * @return the lecture
	 */
	public Lecture getLecture() {
		return lecture;
	}

	/**
	 * @param lecture2 the lecture to set
	 */
	public void setLecture(Lecture lecture2) {
		this.lecture = lecture2;
	}

}
